package cn.biwysh.exam.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.biwysh.exam.entity.User;

public class yhgl extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
		String url="../WEB-INF/jsp/gl/tjyh.jsp";
        if(request.getParameter("page")!=null){
        	if("yhlist".equals(request.getParameter("page"))){
        		url="../WEB-INF/jsp/gl/yhlist.jsp";
        	}else if("xgmm".equals(request.getParameter("page"))){
        		url="../WEB-INF/jsp/gl/xgmm.jsp";
        	}
        	HttpSession session = request.getSession(false);
        	if(session!=null){
        		User user = (User) session.getAttribute("user");
        		if(user!=null){
                   if(user.getRight()==1){
                	   url="../WEB-INF/jsp/gl/xgmm.jsp";
                   }        			
        		}
        	}
        }
		response.setContentType("text/html");
		RequestDispatcher requestDispatcher = request.getRequestDispatcher(url);
		requestDispatcher.forward(request, response);	
	}

    public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
		this.doGet(request, response);
	}

}
